#!/usr/bin/perl
#Programmer: Rory Carmichael
#Purpose: move files to orthomcl friendly format
#Usage: orthomcl_rename.pl <file_list>

my %lut;
while (my $line = <>) {
	chomp $line;
	$lut{$line} = $line;
	my @parts = split(/_/, $line);
	my $bits = substr($parts[0],0,1) . lc(substr($parts[1],0,3));
	if(length($bits) != 4) {
		$bits .= lc(substr($parts[2],0,4-length($bits)));
	}
	$lut{$line} = "$bits.fasta"; 
}

foreach my $key (keys(%lut)) {
	`mv $key $lut{$key}`;
	print "$key\t" . $lut{$key} . "\n";
}
